home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / hal / scripts / linux / hal-system-killswitch-get-power-linux < prev    next >
Encoding:
Text File  |  2009-07-05  |  2.6 KB  |  84 lines

  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2007 Bastien Nocera <bnocera@redhat.com>
  4. # Copyright (C) 2007 David Zeuthen <davidz@redhat.com>
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10.  
  11. if [ "$HAL_PROP_KILLSWITCH_TYPE" = "bluetooth" ]; then
  12.     if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "sonypic" ]; then
  13.     value="`hal-system-sonypic getbluetooth`"
  14.     if [ $? -ne 0 ]; then
  15.         echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  16.         echo "hal-system-sonypic returned unexpected value" >&2
  17.         exit 1
  18.     fi
  19.     exit ${value}
  20.     elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then
  21.     value="`hal-system-smbios --st_bt`"
  22.     if [ "$value" = "0" ]; then
  23.         exit 1
  24.     elif [ "$value" = "1" ]; then
  25.         exit 0
  26.     else
  27.         echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  28.         echo "hal-system-smbios returned $value" >&2
  29.             exit 1
  30.     fi
  31.     elif [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = thinkpad -a -r "$HAL_PROP_LINUX_SYSFS_PATH" ]; then
  32.     read value < $HAL_PROP_LINUX_SYSFS_PATH 2> /dev/null
  33.     if [ $? -eq 0 ]; then
  34.         exit $value
  35.     else
  36.             echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  37.             echo "cannot read $HAL_PROP_LINUX_SYSFS_PATH" >&2
  38.             exit 1
  39.         fi
  40.     else
  41.     echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  42.     echo "Access type not supported" >&2
  43.     exit 1
  44.     fi
  45. elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wlan" ]; then
  46.     if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then
  47.     value="`hal-system-smbios --st_wlan`"
  48.     if [ "$value" = "0" ]; then
  49.         exit 1
  50.     elif false && [ "$value" = "1" ]; then
  51.         exit 0
  52.     else
  53.         echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  54.         echo "hal-system-smbios returned $value" >&2
  55.             exit 1
  56.     fi
  57.     else
  58.     echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  59.     echo "Access type not supported" >&2
  60.     exit 1
  61.     fi
  62. elif [ "$HAL_PROP_KILLSWITCH_TYPE" = "wwan" ]; then
  63.     if [ "$HAL_PROP_KILLSWITCH_ACCESS_METHOD" = "dell" ]; then
  64.     value="`hal-system-smbios --st_wwan`"
  65.     if [ "$value" = "0" ]; then
  66.         exit 1
  67.     elif [ "$value" = "1" ]; then
  68.         exit 0
  69.     else
  70.         echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  71.         echo "hal-system-smbios returned $value" >&2
  72.             exit 1
  73.     fi
  74.     else
  75.     echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  76.     echo "Access type not supported" >&2
  77.     exit 1
  78.     fi
  79. else
  80.     echo "org.freedesktop.Hal.Device.KillSwitch.NotSupported" >&2
  81.     echo "Killswitch type not supported" >&2
  82.     exit 1
  83. fi
  84.